﻿@{
    ViewBag.Title = "Choose";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<script>
    $(function ()
    {
        gridList();

        selectGridAll();
    });

    function selectGridAll()
    {
        var jqGrid = $("#chooseMzhGrid");
        // 拿到所有行id
        var jqGridIDs = jqGrid.getDataIDs();
        for (var i = 0; i < jqGridIDs.length; i++) {
            jqGrid.setSelection(jqGridIDs[i], true);
        }
    }

    function GetMzhInfo()
    {
        var PrescriptionInfo = sessionStorage.getItem("MzhInfo");
        if (PrescriptionInfo)
        {
            sessionStorage.removeItem("MzhInfo")
            return $.parseJSON(PrescriptionInfo);
        }
    }

    function gridList()
    {
        var $gridList = $("#chooseMzhGrid");
        $gridList.newtouchLocalDataGrid(
        {
            multiselect: false,
            unwritten: false,
            height: 150,
                colModel: [
                    { label: '挂号日期', name: 'ghrq', width: 120, align: 'left' },
                    { label: '门诊号', name: 'mzh', width: 120, align: 'left' },
                    { label: "姓名", name: "xm", width: 130, align: 'left' },
                    { label: '科室名称', name: 'ksmc', width: 80, align: 'left' },
                    { label: '医生名称', name: 'ysmc', width: 50, align: 'left' },
                    { label: '病人性质', name: 'brxzmc', width: 50, align: 'left' },
            ]
        });
        $gridList.newtouchLocalDataGrid(null, GetMzhInfo());
    }

    function submitForm(callback)
    {
        var seleRow = $("#chooseMzhGrid").jqGridRowValue();
        var mzh = seleRow.mzh;
        if (!!!mzh) {
            $.modalAlert("尚未选择一条记录", "error");
            return;
        }
        callback(mzh);
        $.modalClose();
    }
</script>

<div class="gridPanel">
    <table id="chooseMzhGrid"></table>
</div>
